/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package photo;

import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

/**
 *
 * @author Alexx
 */
public class AddPhoto extends JPanel {
    String path;
    private Image img;
    
    public AddPhoto(String path)
    {
        this.path = path;
        loadImage(path);
    }
    
    public void loadImage(String path) {
    Image img = new ImageIcon(path).getImage();  
    this.img = img;
    Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
    setPreferredSize(size);
    setMinimumSize(size);
    setMaximumSize(size);
    setSize(size);
    setLayout(null);
  }
    
  public void paintComponent(Graphics g) {
    g.drawImage(img, 0, 0, null);
  }
    
}
